<?php 

/**create by fu */
namespace app\api\controller\v1;

use app\api\controller\BaseController;
use app\api\validate\IDMustBePostiveInt;
use app\api\service\Pay as PayService;
use app\api\service\WxNotify;
/**
 *  
 */
class Pay extends BaseController
{
	protected $btforeActionList = [
		'checkExclusiveScope' => ['only' => 'getPreOrder'],
	];

	public function getPreOrder($id='')
	{
		(new IDMustBePostiveInt())->goCheck();
		
		$pay = new PayService($id);
		$res = $pay->pay();
		p($res);


	}


	/**
	 * z.cn/api/v1/pay/notify
	 * 接受微信 异步通知
	 */
	public function receiveNotify()
	{
		/** 1: 检测库存 超卖
		 *  2: 更新订单状态
		 *  3: 减少库存
		 *  如果成功处理 返回微信成功处理信息    否则 返回没有成功处理  
		 *
		 */
        $notify = new WxNotify();
        $notify->Handle();
	}

	
	 
}








 ?>